import Vue from 'vue';
import Router from 'vue-router';
import Main from '@/app/views/Main';
import Session from '@/lib/Session';

Vue.use(Router);

const baseRoute = [
  {
    path: '/',
    component: Main,
    children: [
      {path: 'a', component: () => import('@/app/views/Top')},
    ],
  },
  {path: '/404', component: () => import('@/app/views/404')},
  {path: '*', redirect: '/404'},
];

// 初始化路由
const router = new Router({mode: 'history', base: process.env.BASE_URL, routes: [...baseRoute]});

// 设置路由钩子 中间件
router.beforeEach((to, from, next) => {
  next();
});

export default router;
